package com.yodawnla.attackTitan2.scene;

import android.view.KeyEvent;

import com.yodawnla.attackTitan2.system.SE;
import com.yodawnla.attackTitan2.system.Tex;
import com.yodawnla.lib.YoScene;
import com.yodawnla.lib.util.widget.YoButton;

public class InfoScene extends YoScene
{
	YoButton mYoAD;
	
	@Override
	public void loadScene()
	{
		YoButton infoBg= new YoButton(this, 0, 0, getTexture(Tex.Tech))
		{
			public void onClickedEvent()
			{
				playSound(SE.Click);
				toScene("TitleScene");
			}
		};
		this.attachChild(infoBg);
		
		mYoAD = new YoButton(this, 0, 720, getTexture(Tex.YoAD))
		{
			@Override
			public void onPressedEvent()
			{
				playSound(SE.Click);
				showLink("http://www.facebook.com/pages/YoDawnLa-%E9%81%8A%E6%A8%82%E9%BB%A8/473502306006935?ref=stream");
			}
		};
		mYoAD.setVisible(false);
		mScene.attachChild(mYoAD);
	}

	@Override
	public void onExitScene()
	{
	}

	@Override
	public boolean onKeyDown(final int pKeyCode, final KeyEvent pEvent) 
	{
		if(pKeyCode == KeyEvent.KEYCODE_BACK && pEvent.getAction() == KeyEvent.ACTION_DOWN)
		{
			playSound(SE.Click);
			toScene("TitleScene");
			return true;
		}
		return false;
	}
	
	@Override
	public void onFailedToReceiveAd()
	{
		mYoAD.setVisible(true);
	}
}